﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Jabr.Logic.Roster
{
    public class DisplayableGroup : DisplayableItem
    {
        public DisplayableGroup(string name)
        {
            this.GroupName = name;
        }

        public void Delete()
        {
            foreach (DisplayableContact item in this.Nodes)
                item.Delete();
            this.Remove();
        }

        public string GroupName
        {
            get
            {
                return this.Text;
            }
            set
            {
                this.Name = this.Text = value;
                foreach (DisplayableContact item in this.Nodes)
                    item.GroupAdd(this);
            }
        }

        public void ContactAdd(DisplayableContact dc)
        {
            this.Nodes.Add(dc);
        }
        public void ContactRemove(DisplayableContact dc)
        {
            this.Nodes.Remove(dc);
        }
    }
}
